package com.aaa.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName: webMvcConfigrer
 * @Description: TODO
 * @Author: 86139
 * @Date: 2021/7/28 23:04
 * @Version:1.0
 **/
@Configuration
public class webMvcConfigrer implements WebMvcConfigurer {
    @Value("${filepath}")
    String filepath;


    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
//        配置图片的路径
        registry.addResourceHandler("/img/**").addResourceLocations("file:"+filepath);
    }
}
